#ifndef _ACTOR_H_
#define _ACTOR_H_

#include <string>

struct Actor {
	int id = 1;
	std::string account = "account";
	int platform = 1;
	std::string platformId = "platformId";
	int server = 1;
	std::string name = "name";
	int accupation = 1;
	int level = 1;
	int exp = 1;
	int rmb = 1;
	int gold = 1;
	int bindGold = 1; 
	int bindRmb = 1;
	int outlook1 = 1;
	int outlook2 = 1;
	int outlook3 = 1;
	int firstLogin = 1;
	std::string props = "props";
	int weaponOutlook = 1;
	int weaponQuality = 1;
	int weaponUpgradeLv1 = 1;
	int deletedTick = 1;
	int createtick = 1;
	int logintick = 1;
	int logouttick = 1;
	int onlinetick = 1;
	int banbatch = 1;
	int bantime = 1;
	int banstarttick = 1;
	std::string banreason = "banreason";
	int silencetime = 1;
	std::string silencereason = "silencereason";
	int sex = 1;
	int hair = 1;
	int haircolor = 1;
	int face = 1;
	std::string scene = "scene";
	int x = 1;
	int y = 1;
	int z = 1;
	std::string props2 = "props2";
	int loverId = 1;
	int fashionClothes = 1;
	int fashionWeapon = 1;
	int flowerCount = 1;
	int guildId = 1;
	int power = 1;
	std::string guildName = "guildName";
	int guildContrib = 1;
	int flowerTicket = 1;
	int chessMoney = 1;
};

std::string hmget(std::string& user) {
	char buf[102400] = {0};
	int len = 0;
	len += sprintf((char*)buf + len, "HMSET %s id account platform platformId server name accupation ", user.c_str());
	len += sprintf((char*)buf + len, "level exp rmb gold bindGold bindRmb outlook1 outlook2 outlook3 firstLogin ");
	len += sprintf((char*)buf + len, "props weaponOutlook weaponQuality weaponUpgradeLv1 deletedTick createtick logintick logouttick onlinetick banbatch ");
	len += sprintf((char*)buf + len, "bantime banstarttick banreason silencetime silencereason sex hair haircolor face scene ");
	len += sprintf((char*)buf + len, "x y z props2 loverId fashionClothes fashionWeapon flowerCount guildId power ");
	len += sprintf((char*)buf + len, "guildName guildContrib flowerTicket chessMoney");
	return buf;
}

std::string hmset(std::string& user, const Actor& actor) {
	char buf[102400] = {0};
	int len = 0;
	len += sprintf((char*)buf + len, "HMSET %s %s %d %s %s %s %d %s %s %s %d %s %s %s %d ",
		user.c_str(), "id", actor.id, "account", 
                actor.account.c_str(), "platform", actor.platform, "platformId", 
                actor.platformId.c_str(), "server", actor.server, "name", 
                actor.name.c_str(), "accupation", actor.accupation);
	len += sprintf((char*)buf + len, "%s %d %s %d %s %d %s %d %s %d %s %d %s %d %s %d %s %d %s %d ",
		"level", actor.level, "exp", actor.exp, "rmb", actor.rmb, 
		"gold", actor.gold, "bindGold", actor.bindGold, "bindRmb", 
                actor.bindRmb, "outlook1", actor.outlook1, "outlook2", 
		actor.outlook2, "outlook3", actor.outlook3, "firstLogin", 
                actor.firstLogin);
	len += sprintf((char*)buf + len, "%s %s %s %d %s %d %s %d %s %d %s %d %s %d %s %d %s %d %s %d ",
 		"props", actor.props.c_str(),
                "weaponOutlook", actor.weaponOutlook, "weaponQuality", 
		actor.weaponQuality, "weaponUpgradeLv1", actor.weaponUpgradeLv1, 
                "deletedTick", actor.deletedTick, "createtick", actor.createtick, 
		"logintick", actor.logintick, "logouttick", actor.logouttick, 
                "onlinetick", actor.onlinetick, "banbatch", actor.banbatch);
	len += sprintf((char*)buf + len, "%s %d %s %d %s %s %s %d %s %s %s %d %s %d %s %d %s %d %s %s ", 
                "bantime", actor.bantime, "banstarttick", actor.banstarttick, 
                "banreason", actor.banreason.c_str(), "silencetime", 
                actor.silencetime, "silencereason", actor.silencereason.c_str(), 
                "sex", actor.sex, "hair", actor.hair, "haircolor", actor.haircolor,
                "face", actor.face, "scene", actor.scene.c_str());
	len += sprintf((char*)buf + len, "%s %d %s %d %s %d %s %s %s %d %s %d %s %d %s %d %s %d %s %d ",
		"x", actor.x, "y", actor.y, "z", actor.z, "props2", 
		actor.props2.c_str(), "loverId", actor.loverId, "fashionClothes", 
                actor.fashionClothes, "fashionWeapon", actor.fashionWeapon, 
                "flowerCount", actor.flowerCount, "guildId", actor.guildId, 
                "power", actor.power);
	len += sprintf((char*)buf + len, "%s %s %s %d %s %d %s %d",
		"guildName", actor.guildName.c_str(), 
                "guildContrib", actor.guildContrib, "flowerTicket", actor.flowerTicket, 
                "chessMoney", actor.chessMoney);
	return buf;
}

#define HMSET(user, actor) "HMSET %s %s %d %s %s %s %d %s %s %s %d %s %s %s %d "\
		"%s %d %s %d %s %d %s %d %s %d %s %d %s %d %s %d %s %d %s %d "\
		"%s %b %s %d %s %d %s %d %s %d %s %d %s %d %s %d %s %d %s %d "\
		"%s %d %s %d %s %s %s %d %s %s %s %d %s %d %s %d %s %d %s %s "\
		"%s %d %s %d %s %d %s %b %s %d %s %d %s %d %s %d %s %d %s %d "\
		"%s %s %s %d %s %d %s %d", user, "id", actor.id, "account", \
		actor.account.c_str(), "platform", actor.platform, "platformId", \
		actor.platformId.c_str(), "server", actor.server, "name", \
		actor.name.c_str(), "accupation", actor.accupation, "level", \
		actor.level, "exp", actor.exp, "rmb", actor.rmb, \
		"gold", actor.gold, "bindGold", actor.bindGold, "bindRmb", \
		actor.bindRmb, "outlook1", actor.outlook1, "outlook2", \
		actor.outlook2, "outlook3", actor.outlook3, "firstLogin", \
		actor.firstLogin, "props", actor.props.data(), actor.props.size(),\
		"weaponOutlook", actor.weaponOutlook, "weaponQuality", \
		actor.weaponQuality, "weaponUpgradeLv1", actor.weaponUpgradeLv1, \
		"deletedTick", actor.deletedTick, "createtick", actor.createtick, \
		"logintick", actor.logintick, "logouttick", actor.logouttick, \
		"onlinetick", actor.onlinetick, "banbatch", actor.banbatch, \
		"bantime", actor.bantime, "banstarttick", actor.banstarttick, \
		"banreason", actor.banreason.c_str(), "silencetime", \
		actor.silencetime, "silencereason", actor.silencereason.c_str(), \
		"sex", actor.sex, "hair", actor.hair, "haircolor", actor.haircolor, \
		"face", actor.face, "scene", actor.scene.c_str(), "x", actor.x, \
		"y", actor.y, "z", actor.z, "props2", actor.props2.data(), \
		actor.props2.size(), "loverId", actor.loverId, "fashionClothes", \
		actor.fashionClothes, "fashionWeapon", actor.fashionWeapon, \
		"flowerCount", actor.flowerCount, "guildId", actor.guildId, \
		"power", actor.power, "guildName", actor.guildName.c_str(), \
		"guildContrib", actor.guildContrib,"flowerTicket", \
		actor.flowerTicket, "chessMoney", actor.chessMoney

#endif
